package com.ruoyi.controller;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.dto.FirstAlertDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;


@Api(tags = "初步预警分级模型算法")
@RequestMapping("/riskEvaluateWeb")
@RestController
public class FirstAlertWebController {

    @ApiOperation("获取预警等级--1:一级预警;2:二级预警;3:三级预警;4:四级预警")
    @PostMapping("/getAlertLevel")
    public AjaxResult getAlertLevel(@RequestBody FirstAlertDto firstAlertDto) {
        Map map = new HashMap();
        map.put("number",firstAlertDto.getNumber());
        String bjdj =firstAlertDto.getBjdj();
        String fxdj =firstAlertDto.getFxdj();
        if("1".equals(bjdj)){
            if("1".equals(fxdj)){
                map.put("code","1");
                map.put("name","一级预警");
            }else if("2".equals(fxdj)){
                map.put("code","2");
                map.put("name","二级预警");
            }else if("3".equals(fxdj)){
                map.put("code","3");
                map.put("name","三级预警");
            }else if("4".equals(fxdj)){
                map.put("code","4");
                map.put("name","四级预警");
            }
        }else if("2".equals(bjdj)){
            if("1".equals(fxdj)){
                map.put("code","1");
                map.put("name","一级预警");
            }else if("2".equals(fxdj)){
                map.put("code","2");
                map.put("name","二级预警");
            }else if("3".equals(fxdj)){
                map.put("code","3");
                map.put("name","三级预警");
            }else if("4".equals(fxdj)){
                map.put("code","4");
                map.put("name","四级预警");
            }
        }else if("3".equals(bjdj)){
            if("1".equals(fxdj)){
                map.put("code","3");
                map.put("name","三级预警");
            }else if("2".equals(fxdj)){
                map.put("code","3");
                map.put("name","三级预警");
            }else if("3".equals(fxdj)){
                map.put("code","4");
                map.put("name","四级预警");
            }else if("4".equals(fxdj)){
                map.put("code","4");
                map.put("name","四级预警");
            }
        }else if("4".equals(bjdj)){
            if("1".equals(fxdj)){
                map.put("code","2");
                map.put("name","二级预警");
            }else if("2".equals(fxdj)){
                map.put("code","2");
                map.put("name","二级预警");
            }else if("3".equals(fxdj)){
                map.put("code","3");
                map.put("name","三级预警");
            }else if("4".equals(fxdj)){
                map.put("code","4");
                map.put("name","四级预警");
            }
        }

        return AjaxResult.success(map);
    }

}
